import { DictItem } from '@/types/global';
import { apiGetDictDataAll } from '@/api/system';

export const getKeys = (): Promise<Record<string, DictItem[]>> => {
  return apiGetDictDataAll().then((res) => {
    const obj = res.data.reduce((total: any, t: any) => {
      total[t.dict_type] = t.dict_data.map((m) => ({
        value: m.dict_value,
        label: m.dict_label,
      }));
      return total;
    }, {});

    return obj;
  });
};
